const Mock = require('mock.js');

const Random =Mock.Random;

const produceData = function(opt){
    let articles= [];
    for (let i=0; i<=30; i++) {
        let newArticleObject = {
           title: Random.csentence(5,30),
           author_name: Random.cname()
        }
        articles.push(newArticleObject)
    }
    return {
        data:articles
    }
}

Mock.mock('/user','post|get/i',produceData);